package cate.game.play.skill.passive.god;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;
import easy.java.struct.ref.DoubleRef;

/**
 * 受到技能攻击时可直接削减自身攻击*29%的伤害，削减量最多不超过原始伤害量的25%。
 */
public class 混沌之力PH extends PassiveHandler {

	private double 减少系数;

	private double 最大系数;

	//减少系数=2900&最大系数=2500
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		减少系数 = args.getWDouble("减少系数", 0d);
		最大系数 = args.getWDouble("最大系数", 0d);
	}

	@Override
	public void adjustSkillDamage(ActionCtx action, Fighter actor, int reason, DoubleRef doubleRef) {
		double value = skill.owner.attr.attTotal()*减少系数;
		double max = doubleRef.v*最大系数;
		value = Math.min(value, max);
		doubleRef.v-=value;
	}
}
